<script setup>
import {navigateBack, reLaunch} from '@/utils/uni-api-wrap/route'
import {usePages} from '@/hooks/usePages'

const { isFirstPage } = usePages()

const props = defineProps({
  customEvent: Boolean
})
const emit = defineEmits(['clickLeft'])

const clickLeft = () => {
  if (props.customEvent) {
    emit('clickLeft')
  } else {
    if (isFirstPage.value) return reLaunch('/pages/index/index')
    navigateBack()
  }
}

</script>

<template>
  <uni-nav-bar left-icon="left" :border="false" background-color="transparent" @click-left="clickLeft" v-bind="$attrs" />
</template>

<style scoped lang="scss">

</style>
